<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Description: 
  User: wangguichun
  Date: 2018/4/16
  Time: 16:52
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>首页</title>

    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/base.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/nav.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/mask.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/message.css">
</head>
<body>
<jsp:include page="../common/nav.jsp"/>
<div class="main">
    <div class="content">

        <h3>全部消息</h3>
        <ul>
            <c:forEach items="${pageInfo.list}" var="message">
                <li>
                    <h4 class="timeNeedConvert">${message.time}</h4>
                    <div class="messages">
                            <%--评论了提问--%>
                        <c:if test="${message.type == 1}">
                            <ul class="message-comment">
                                <li class="sprite-message-comment"></li>
                                <li>
                                    <a href="javascript:showUserMask(${message.fromId});">${message.fromUser.name}</a>
                                    评论了你的问题： <a
                                        href="${pageContext.request.contextPath}/ques/${message.objecId}">${message.content}</a>
                                </li>
                            </ul>
                        </c:if>
                            <%--回答--%>
                        <c:if test="${message.type == 2}">
                            <ul class="message-answer">
                                <li class="sprite-message-answer"></li>
                                <li>
                                    <a href="javascript:showUserMask(${message.fromId});">${message.fromUser.name}</a>
                                    对你的问题 <a
                                        href="${pageContext.request.contextPath}/ques/${message.objecId}">${message.content}</a>
                                    给出了答案
                                </li>
                            </ul>
                        </c:if>
                            <%--评论了回答--%>
                        <c:if test="${message.type == 3}">
                            <ul class="message-comment">
                                <li class="sprite-message-comment"></li>
                                <li>
                                    <a href="javascript:showUserMask(${message.fromId});">${message.fromUser.name}</a>
                                    评论了你在问题 <a
                                        href="${pageContext.request.contextPath}/ques/${message.objecId}">${message.content}
                                </a>下的回答
                                </li>
                            </ul>
                        </c:if>
                            <%--收藏--%>
                        <c:if test="${message.type == 4}">
                            <ul class="message-comment">
                                <li class="sprite-message-comment"></li>
                                <li>
                                    <a href="javascript:showUserMask(${message.fromId});">${message.fromUser.name}</a>
                                    收藏了你的问题： <a
                                        href="${pageContext.request.contextPath}/ques/${message.objecId}">${message.content}</a>
                                </li>
                            </ul>
                        </c:if>
                            <%--关注--%>
                        <c:if test="${message.type == 5}">
                            <ul class="message-follow">
                                <li class="sprite-message-follow"></li>
                                <li>
                                    <a href="javascript:showUserMask(${message.fromId});">${message.fromUser.name}</a>
                                    关注了你
                                </li>
                            </ul>
                        </c:if>
                    </div>
                </li>
            </c:forEach>
        </ul>
        <div id="pagination"></div>
    </div>
    <div class="sidebar">
        <%--右侧栏--%>
        <jsp:include page="../common/sidebar.jsp"/>

        <jsp:include page="../common/footer.jsp"/>
    </div>
</div>
<jsp:include page="../common/mask.jsp"/>

</body>

<script src="${pageContext.request.contextPath}/js/MyConverter.js"></script>
<script src="${pageContext.request.contextPath}/js/myPagination.js"></script>
<script>
    $(function () {
        var div = $("#pagination");
        var curPage = ${pageBean.curPage};
        var allPage = ${pageBean.allPage};
        var length = 5;
        paginationConstructor(div, length, curPage, allPage);
    });
</script>
</html>


